import torch
from torch import nn


class Embedding(nn.Module):
    def __init__(self, features:int, d_model:int, device):
        super(Embedding, self).__init__()
        self.d_model = d_model
        self.features = features
        self.line = nn.Linear(self.features, self.d_model).to(device=device)

    # 输入一个(样本数量，时间点个数，特征数)的向量，将特征维映射到d_model维
    def forward(self, x:torch.Tensor) -> torch.Tensor:
        return self.line(x)
        